package com.cyt.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cyt.dao.impl.ShangPingXXDaoImpl;
import com.cyt.dao.impl.XingWenFengLeiDaoImpl;
import com.cyt.dao.impl.XingWengXiZhiDaoImpl;
import com.cyt.entity.ShangPingXX;
import com.cyt.entity.XingWenFengLei;
import com.cyt.entity.XingWengXiZhi;

// 调用了新闻分类  新闻详细分类 实现类方法
public class NewsServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
			XingWenFengLeiDaoImpl xDao= new XingWenFengLeiDaoImpl();//创建对象
		    List <XingWenFengLei> list=xDao.getXingWenFengLei();//调用方法获得用户集合
		   request.setAttribute("xw", list);//将数据存入request中
			
		   int xid =Integer.parseInt(request.getParameter("categoryId"));
		   XingWengXiZhiDaoImpl xWXZDao=new XingWengXiZhiDaoImpl();
		   List <XingWengXiZhi> xWList =  xWXZDao.getXingWengXiZhi(xid);
		   request.setAttribute("XingWengXiZhiList", xWList);//将数据存入request中
		   
		request.getRequestDispatcher("article_list.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}
}
